import { asyncRoutes, constantRoutes, routerMapping } from '@/router'
export default {
    namespaced: 'permission',
    state: () => ({
        routes: JSON.parse(localStorage.getItem('rights') || '[]'),
    }),
    mutations: {
        saveRights(state) {
            localStorage.setItem('rights', JSON.stringify(state.routes))
        },
        setRoutes(state, rights) {
            state.routes = rights
            this.commit('permission/saveRights')
        },
        clearRights(state) {
            state.routes = []
            localStorage.removeItem('rights')
        }
    },
}